package com.depth.viewer.events
{

import flash.events.Event;

public class AppEvent extends Event
{
	public static const DATA_CHANGED:String = "dataChanged";
	
    public static const APP_ERROR:String = "appError";

    
    public static const CONFIG_LOADED:String = "configLoaded";


    public static const WIDGET_FOCUS_IN:String = "focusWidgetIn";
	public static const WIDGET_FOCUS_OUT:String = "focusWidgetOut";

	public static const WIDGET_STATE_CHANGED:String = "widgetStateChanged";
   
    public static const WIDGET_OPEND:String = "widgetOpened";
	public static const WIDGET_CLOSED:String = "widgetClosed";
	public static const WIDGET_MINIMIZED:String = "widgetMinimized";

	public static const WIDGET_OPEN_START:String = "widgetOpenStart";
	public static const WIDGET_OPEN_END:String= "widgetOpenEnd";
	
	public static const WIDGET_CLOSE_START:String= "widgetCloseStart";
	public static const WIDGET_CLOSE_END:String= "widgetCloseEnd";
	
	public static const WIDGET_MINIMIZE_START:String= "widgetMinimizeStart";
	public static const WIDGET_MINIMIZE_END:String= "widgetMinimizeEnd";

	public static const WIDGET_RUN:String = "widgetRun";
	public static const WIDGET_STOP:String = "widgetStop";

	public static const VIEWR_STYLE_LOAD_COMPLETE:String = "viewerStyleLoadComplete";
	public static const VIEWR_RSL_LOAD_COMPLETE:String = "viewerRSLLoadComplete";
	
	public static const NETWORK_ERROR:String = "networkError";

	
	//--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    public function AppEvent(type:String, data:Object = null, callback:Function = null,bubbles:Boolean = true,cancelable:Boolean = true)
    {
        super(type,bubbles,cancelable);
        _data = data;
        _callback = callback;
    }

    //--------------------------------------------------------------------------
    //
    //  Properties
    //
    //--------------------------------------------------------------------------

    private var _data:Object;

    private var _callback:Function;

    /**
     * The data will be passed via the event. It allows the event dispatcher to publish
     * data to event listener(s).
     */
    public function get data():Object
    {
        return _data;
    }

    /**
     * @private
     */
    public function set data(value:Object):void
    {
        _data = value;
    }

    /**
     * The callback function associated with this event.
     */
    public function get callback():Function
    {
        return _callback;
    }

    /**
     * @private
     */
    public function set callback(value:Function):void
    {
        _callback = value;
    }

    public override function clone():Event
    {
        return new AppEvent(this.type, this.data);
    }
}

}
